n = int(input())
a = list(input().split())
st = set()
for i in a:
    now = 0
    for c in i:
        now += int(c)
    st.add(now)
print(len(st))
ans = [i for i in st]
ans = [str(i) for i in sorted(ans)]
print(' '.join(ans), end='')
